package com.pactera.asmp.server.service;

import com.pactera.asmp.server.entity.DeviceInfoSearchDTO;
import com.pactera.asmp.server.entity.MasterProjectDeviceVo;
import com.pactera.asmp.server.entity.ProjectMasterComDeviceVo;
import com.pactera.asmp.server.entity.ProjectMasterDeviceVo;
import com.pactera.asmp.server.entity.ResponseResult;
import com.pactera.asmp.server.pojo.DeviceInfo;
import com.pactera.asmp.server.utils.PageDataResult;

import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestBody;

import java.io.IOException;
import java.util.List;
import java.util.Set;

/**
 * @ProjectName: server
 * @Package com.pactera.asmp.server.service
 * @ClassName: IDeviceServcie
 * @Description: IDeviceService
 * @Date 2020/06/28 16:49
 * @Author lvzhiqiang
 * @Version 1.0
 */
public interface IDeviceServcie {

    boolean insert(DeviceInfo deviceInfo);

    boolean delete(Integer id);

    boolean delete(List<Integer> datas);

    boolean update(DeviceInfo deviceInfo);

    boolean operationDevice(String duid, Integer userId, Integer status, String userName);

    DeviceInfo get(Integer id);

    PageDataResult get(DeviceInfoSearchDTO deviceInfoSearchDTO, int page, int limit);

    boolean updateStatus(String duid, Integer status);

    DeviceInfo selectByDuidAndSn(@Param("duid") String duid, @Param("sn") String sn);

    void sendToDeviceMessage(String duid, String content) throws IOException;

    boolean updateAutoTestStatus1( String duid, Integer userId, String userName);
    boolean disconnectAutoTestDevice( String duid);
    boolean deviceOffline(String duid);
    int updateDeviceTask(DeviceInfo deviceInfo);

    int clearDeviceTaskInfo( String duid,Integer historyTaskId,Integer taskUserId);
    int clearDeviceTaskInfo2( String duid,Integer taskId,Integer taskUserId);

    int deviceOfflineByDuids(@Param("duidIds") Set<String> duidIds);

    ResponseResult registerDevice(@RequestBody DeviceInfo deviceInfo);

    /**
     * 通过 projectId 获取设备列表
     * @param projectId
     * @param masterComputerId
     * @return
     */
    List<ProjectMasterComDeviceVo> deviceListByProjectId(Integer projectId, Integer masterComputerId,String cuid);

    boolean operationDeviceForSimulator(String duid, Integer userId, Integer status, String userName);
    void onlineDuidSimulator(String duid,String simulatorId);

    void deviceOfflineBySimulatorId(String duid, String simulatorId, int duidStatus);

    List<ProjectMasterDeviceVo> deviceBindByProjectId(Integer projectId);

    List<MasterProjectDeviceVo> deviceBindByMasterId(Integer masterId);
    int updateNickName(DeviceInfo deviceInfo);

    List<ProjectMasterComDeviceVo> getDevicesByCuid(String cuid);

    List<DeviceInfo> deviceUnBindByProjectId(Integer projectId);

    boolean operationDeviceForAux(String duid, Integer userId, Integer status, String userName);

    ResponseResult devicePackageName(DeviceInfo deviceInfo);

    ResponseResult handleDeviceOffline(DeviceInfo deviceInfo);
}
